(function(){
    //点击返回
    $(".btGoBackTM").on("tap",function(){
        window.location.href="../html/Weichuxing.html";
    });
    //按日期订单显示
    show2Fun()
    function show2Fun(){
        var youXieTime={
            XT:sessionStorage.getItem("key2")
        }
        $.ajax({
            type:"post",
            url:"/ajaxShow1TM",
            data:youXieTime,
            success:function(info){
                console.log(info)
                if(info.length!=0){
                    var html="";
                    var num=-1;
                    for(var i=0;i<info.length;i++){
                        num++;
                        html+="<ul><li>"+"姓名："+info[i].by_name+"</li>" +
                            "<li>"+"购买时间："+info[i].by_time+"</li>" +
                            "<li>"+"出发站："+info[i].go_station+"</li>" +
                            "<li>"+"目的站："+info[i].arrival_station+"</li>" +
                            "<li>"+"出发时间："+info[i].go_off+"</li>" +
                            "<li>"+"到达时间："+info[i].arrival_time+"</li>" +
                            "<li class='liClickTM'>"+"订单号："+info[i].id+"</li>" +
                            "<li>"+"车次："+info[i].head_word+"</li></ul>"+
                            "<div style='height:4vh'><button class='btnBackTM' style='background-color: #18B4ED;color: #fffefe;'" +
                            "Num="+num+">退订</button></div>"
                    }
                    $(".showBoxTM").html(html);
                    html="";
                    $(".btnBackTM").on("click",function(){
                        var dinNum={
                            DN:$(".liClickTM").eq($(this).attr("Num")).text().slice(4)
                        };
                        $.ajax({
                            type:"post",
                            url:"/ajaxTuiDinPostTM",
                            data:dinNum,
                            success:function(TD_info){
                                if(TD_info.length!=0){
                                    show2Fun();
                                }
                            }
                        })
                    })
                }else{
                    $(".showBoxTM").text("没有订单")
                }
            }
        })
    }

})()
